<meta charset="UTF-8">
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1 style="text-align:center">
        食堂信息
          
      </h1>
   
    </section>

    <!-- Main content -->
    <section class="content">
      <div class="row">
         <div class="col-md-10 col-md-offset-1">
            <!-- Horizontal Form -->
            <div class="box box-info">
                <!-- box header -->
                <div class="box-header with-border">
                <button class="btn btn-danger pull-right"  data-toggle="modal" data-target="#delCanteen" ng-if='!isNewCanteen'><i class="fa fa-close"></i>&nbsp;&nbsp;删除当前食堂</button>
                 <button class="btn btn-danger pull-right"   ng-if='isNewCanteen' ng-click='cancleNewCanteen()'><i class="fa fa-close"></i>&nbsp;&nbsp;取消新增</button>
                <button class="btn btn-success pull-left" ng-click="newCanteen()"><i class="fa fa-plus"></i>&nbsp;&nbsp;新增食堂</button>
                </div>
                <!-- /.box-header -->
                <!-- form start -->
                <form class="form-horizontal">  <!--style="max-height: 450px;overflow-y: auto; overflow-x: hidden;"-->
                <div class="box-body">
                		<div class="form-group" ng-hide="isNewCanteen">
                        <label class="col-sm-3 control-label">食堂编号</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" ng-model="canteenDetails[0].id" readonly="readonly" ng-if="!isNewCanteen">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">食堂名称</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" ng-model="canteenDetails[0].name" ng-required="true">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">食堂电话</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" ng-model="canteenDetails[0].telephone" ng-required="true"> 
                        </div>
                    </div>
                    
                    <div class="form-group">
                        <label class="col-sm-3 control-label">领餐方式</label>
                        <div class="col-sm-9">
                        	<input type="checkbox" id="tangshi" class="chk_1 eattype" ng-model="canteenDetails[0].dining_mode[0].is_checked"/>
													<label for="tangshi" class="checklable" ></label>堂食
                       
                        
                        	<input type="checkbox" id="ziti" class="chk_1 eattype" ng-model="canteenDetails[0].dining_mode[1].is_checked"/>
													<label for="ziti" class="checklable" ></label>自提&nbsp;
													<span ng-show='canteenDetails[0].dining_mode[1].is_checked'>加价:<input type="number" ng-model="canteenDetails[0].dining_mode[1].add_price"  min="0" placeholder="输入加价价格"/></span>
                       
                        
                        	<input type="checkbox" id="waisong" class="chk_1 eattype" ng-model="canteenDetails[0].dining_mode[2].is_checked"/>
													<label for="waisong" class="checklable" ></label>外送&nbsp;
													<span ng-show='canteenDetails[0].dining_mode[2].is_checked'>加价:<input type="number" ng-model="canteenDetails[0].dining_mode[2].add_price"  min="0" placeholder="输入加价价格"/></span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">支付方式</label>
                        <div class="col-sm-9">
                        	<input type="checkbox" id="alipay" class="chk_1 paytype" ng-model="canteenPays.alipay"/>
													<label for="alipay" class="checklable" ></label>支付宝支付
                          <input type="checkbox" id="cardpay" class="chk_1 paytype"  ng-model="canteenPays.card"/>
													<label for="cardpay" class="checklable" ></label>饭卡支付
													<input type="checkbox" id="notiqian" class="chk_1 paytype" ng-model="canteenPays.no_advance"/>
													<label for="notiqian" class="checklable" ></label>不提前支付
													<input type="checkbox" id="wechatpay" class="chk_1 paytype" ng-model="canteenPays.wechat"/>
													<label for="wechatpay" class="checklable" ></label>微信支付
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="allowOut" class="col-sm-3 control-label">是否允许外部订餐</label>
                        <div class="col-sm-9">
                            <input class='tgl tgl-flat' id='allowOut' type='checkbox' ng-model="canteenDetails[0].exterior_dining">
    													<label class='tgl-btn' for='allowOut'></label>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="allowpay" class="col-sm-3 control-label">是否支持现场支付</label>
                        <div class="col-sm-9">
                            <input class='tgl tgl-flat' id='allowpay' type='checkbox' ng-model="canteenDetails[0].field_payment">
    						<label class='tgl-btn' for='allowpay'></label>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">食堂地址</label>
                        <div class="col-sm-9">
                            <textarea rows="5" class="form-control"  style="resize:none" ng-model="canteenDetails[0].address" ng-required="true"></textarea>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">食堂描述</label>
                        <div class="col-sm-9">
                           <textarea rows="5" class="form-control"  style="resize:none" ng-model="canteenDetails[0].describe" ng-required="true"></textarea>
                        </div>
                    </div>
                    
                </div>
                <!-- /.box-body -->
                <div class="box-footer">
                    <button type="button" class="btn btn-default col-md-4 col-sm-4 col-xs-4 btn-lg" ng-click="cancleCanteenEdit(canteenDetails[0].id)"  ng-if='!isNewCanteen'>取消</button>
                    <button type="submit" class="btn btn-info pull-right col-md-4 col-sm-4 col-xs-4 btn-lg" ng-click="saveCanteen(canteenDetails[0].id);">保存</button>
              <!--      <h1 ng-repeat = 'x in temp' on-finish-render-filters>{{x}}</h1>-->
                </div>
                <!-- /.box-footer -->
                </form>
            </div>
          <!-- /.box -->
         </div>
        <!--/.col (right) -->
      </div>
      <!-- /.row -->
    </section>
    <!-- /.content -->
  </div>
  <!-- 删除食堂 -->
  	<div class="modal fade" id="delCanteen" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" >
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" style="text-align:center">提示</h4>
      </div>
      <div class="modal-body form-horizontal">
        <div class="box-body">
           	确定要删除<span ng-bind="canteenDetails[0].name"></span>吗？
        </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default btn-lg pull-left" data-dismiss="modal">取消</button>
        <button type="button" class="btn btn-success btn-lg" ng-click="del_canteen(canteenDetails[0].id);">确定</button>
      </div>
    </div>
  </div>
</div>
<!-- 就餐方式为空时显示提示 -->
<div class="modal fade" id="dining_model" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" >
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" style="text-align:center">提示</h4>
      </div>
      <div class="modal-body form-horizontal">
        <div class="box-body" id='tipText'>
           	请选择至少一种就餐方式后重新保存！
        </div>
      </div>
      <div class="modal-footer">
         <button type="button" class="btn btn-default btn-lg col-md-4 col-md-offset-4" data-dismiss="modal">确定</button>
      </div>
    </div>
  </div>
</div>